/*
 * Copyright 2001-2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 

package org.apache.commons.logging;

import org.apache.commons.logging.impl.LogFactoryImpl;

import com.google.gwt.core.client.GWT;

public abstract class LogFactory {

	protected LogFactory() {
	}

	/**
	 * Get a instance logger for loggin a client
	 * @param clazz - Name of the logger to be constructed
	 * @return logger implementation
	 * @throws LogConfigurationException
	 */
	public abstract Log getInstance(Class clazz)
			throws LogConfigurationException;

	/**
	 * Get a instace of logger for loggin a client
	 * @param name - Name of the logger to be constructed
	 * @return logger implementation
	 * @throws LogConfigurationException
	 */
	public abstract Log getInstance(String name)
			throws LogConfigurationException;

	/**
	 * Get implementation of localFactory
	 * @return LogFactory
	 * @throws LogConfigurationException
	 */
	public static LogFactory getFactory() throws LogConfigurationException {
	
		return (LogFactory) GWT.create(LogFactoryImpl.class);

	}

	/**
	 * Get a logger for loggin a client
	 * @param clazz - Name of the logger to be constructed
	 * @return logger implementation
	 * @throws LogConfigurationException
	 */
	public static Log getLog(Class clazz) throws LogConfigurationException {

		return (getFactory().getInstance(clazz));

	}

	/**
	 * Get a logger for loggin a client
	 * @param name - Name of the logger to be constructed
	 * @return logger implementation
	 * @throws LogConfigurationException
	 */
	public static Log getLog(String name) throws LogConfigurationException {

		return (getFactory().getInstance(name));

	}

}
